<!DOCTYPE html>
<html>
  <head>
  <meta charset='UTF-8'>
  <title>Atom API Documentation</title>
  <link rel='stylesheet' href='../assets/biscotto.css' type='text/css'>
  <script src='../assets/biscotto.js'></script>
  <script src='../assets/search_data.js'></script>
</head>
  <body>
    <div id='base' data-path='..&#47;'></div>
<div id='header'>
  <div id='menu'>
    <a href='../docs/README.md.html' title='Atom'>Atom</a>
    &raquo;
    <a href='../class_index.html' title='Index'>Index</a>
    &raquo;
    <span class='title'>GrammarRegistry</span>
    <nav>
      <ul>
        <li class='noframes'>
          (<a class='noframes' href='GrammarRegistry.html#'>no frames</a>)
        </li>
      </ul>
    </nav>
    <div id='search'>
      <a id='class_list_link' href='../class_list.html'>Classes</a>
      <a id='file_list_link' href='../file_list.html'>Files</a>
      <a id='method_list_link' href='../method_list.html'>Methods</a>
      <a id='extra_list_link' href='../extra_list.html'>Extras</a>
    </div>
  </div>
  <iframe id='search_frame'></iframe>
  <div id='fuzzySearch'>
    <input type='text'>
    <ol></ol>
  </div>
  <div id='help'>
    <p>
      Quickly fuzzy find classes, mixins, methods, file:
    </p>
    <ul>
      <li>
        <span>Ctrl-T</span>
        Open fuzzy finder dialog
      </li>
    </ul>
    <p>
      In frame mode you can toggle the list naviation frame on the left side:
    </p>
    <ul>
      <li>
        <span>Ctrl-L</span>
        Toggle list view
      </li>
    </ul>
    <p>
      You can focus a list in frame mode or toggle a tab in frameless mode:
    </p>
    <ul>
      <li>
        <span>Ctrl-C</span>
        Class list
      </li>
      <li>
        <span>Ctrl-I</span>
        Mixin list
      </li>
      <li>
        <span>Ctrl-F</span>
        File list
      </li>
      <li>
        <span>Ctrl-M</span>
        Method list
      </li>
      <li>
        <span>Ctrl-E</span>
        Extras list
      </li>
    </ul>
    <p>
      You can focus and blur the search input:
    </p>
    <ul>
      <li>
        <span>Ctrl-S</span>
        Focus search input
      </li>
      <li>
        <span>Esc</span>
        Blur search input
      </li>
    </ul>
    <p>
      In frameless mode you can close the list tab:
    </p>
    <ul>
      <li>
        <span>Esc</span>
        Close list tab
      </li>
    </ul>
  </div>
</div>
    <div id='content'>
      <h1>
        Class
        GrammarRegistry
      </h1>
      <div class='stability-1'>
        <span class='heading'></span>
        <div class='message'></div>
      </div>
      <table class='box'>
        <tr>
          <td>Defined in:</td>
          <td>docs&#47;includes&#47;first-mate&#47;src&#47;grammar-registry.coffee</td>
        </tr>
      </table>
      <h2>Overview</h2>
      <div class='docstring'>
  <p>Registry containing one or more grammars.</p>
</div>
<div class='tags'>
</div>
      <h2>Subclasses</h2>
      <p class='children'>
        <a href='Syntax.html'>Syntax</a>
      </p>
      <h2>Instance Method Summary</h2>
      <ul class='summary'>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#addGrammar-instance'>
        ::<strong>addGrammar</strong>(grammar)
      </a>
    </span>
    <span class='desc'>
      Add a grammar to this registry.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#clearGrammarOverrideForPath-instance'>
        ::<strong>clearGrammarOverrideForPath</strong>(filePath)
      </a>
    </span>
    <span class='desc'>
      Remove the grammar override for the given file path.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#clearGrammarOverrides-instance'>
        ::<strong>clearGrammarOverrides</strong>()
      </a>
    </span>
    <span class='desc'>
      Remove all grammar overrides.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#getGrammars-instance'>
        Array ::<strong>getGrammars</strong>()
      </a>
    </span>
    <span class='desc'>
      Get all the grammars in this registry.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#grammarForScopeName-instance'>
        Grammar ::<strong>grammarForScopeName</strong>(scopeName)
      </a>
    </span>
    <span class='desc'>
      Get a grammar with the given scope name.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#grammarOverrideForPath-instance'>
        Grammar ::<strong>grammarOverrideForPath</strong>(filePath)
      </a>
    </span>
    <span class='desc'>
      Get the grammar override for the given file path.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#loadGrammar-instance'>
        ::<strong>loadGrammar</strong>(grammarPath, callback)
      </a>
    </span>
    <span class='desc'>
      Read a grammar asynchronously and add it to the registry.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#loadGrammarSync-instance'>
        Grammar ::<strong>loadGrammarSync</strong>(grammarPath)
      </a>
    </span>
    <span class='desc'>
      Read a grammar synchronously and add it to this registry.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#readGrammar-instance'>
        ::<strong>readGrammar</strong>(grammarPath, callback)
      </a>
    </span>
    <span class='desc'>
      Read a grammar asynchronously but don&#39;t add it to the registry.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#readGrammarSync-instance'>
        Grammar ::<strong>readGrammarSync</strong>(grammarPath)
      </a>
    </span>
    <span class='desc'>
      Read a grammar synchronously but don&#39;t add it to the registry.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#removeGrammar-instance'>
        ::<strong>removeGrammar</strong>(grammar)
      </a>
    </span>
    <span class='desc'>
      Remove a grammar from this registry.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#removeGrammarForScopeName-instance'>
        ::<strong>removeGrammarForScopeName</strong>(scopeName)
      </a>
    </span>
    <span class='desc'>
      Remove the grammar with the given scope name.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#selectGrammar-instance'>
        Grammar ::<strong>selectGrammar</strong>(filePath, fileContents)
      </a>
    </span>
    <span class='desc'>
      Select a grammar for the given file path and file contents.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='GrammarRegistry.html#setGrammarOverrideForPath-instance'>
        Grammar ::<strong>setGrammarOverrideForPath</strong>(filePath, scopeName)
      </a>
    </span>
    <span class='desc'>
      Set the grammar override for the given file path.
    </span>
  </li>
</ul>
      <h2>Instance Method Details</h2>
      <div class='methods'>
  <div class='method_details'>
    <p class='signature' id='addGrammar-instance'>
      ::<strong>addGrammar</strong>(grammar)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Add a grammar to this registry.</p><p>A &#39;grammar-added&#39; event is emitted after the grammar is added.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Grammar)</span>
      <span class='name'>grammar</span>
      &mdash;
      <span class='desc'>The <a href='Grammar.html'>Grammar</a> to add. This should be a value previously returned from <a href='GrammarRegistry.html#readGrammar-instance'>::readGrammar</a> or <a href='GrammarRegistry.html#readGrammarSync-instance'>::readGrammarSync</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='clearGrammarOverrideForPath-instance'>
      ::<strong>clearGrammarOverrideForPath</strong>(filePath)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Remove the grammar override for the given file path.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>filePath</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> file path.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='clearGrammarOverrides-instance'>
      ::<strong>clearGrammarOverrides</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Remove all grammar overrides.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getGrammars-instance'>
      Array ::<strong>getGrammars</strong>()
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get all the grammars in this registry.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Array</tt>)
      &mdash;
      <span class='desc'>Returns a non-empty <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array'>Array</a> of <a href='Grammar.html'>Grammar</a> instances.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='grammarForScopeName-instance'>
      Grammar ::<strong>grammarForScopeName</strong>(scopeName)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get a grammar with the given scope name.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>scopeName</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> such as <code>&quot;source.js&quot;</code>.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Grammar.html'>Grammar</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Grammar.html'>Grammar</a> or undefined.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='grammarOverrideForPath-instance'>
      Grammar ::<strong>grammarOverrideForPath</strong>(filePath)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Get the grammar override for the given file path.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>filePath</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> file path.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Grammar.html'>Grammar</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Grammar.html'>Grammar</a> or undefined.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='loadGrammar-instance'>
      ::<strong>loadGrammar</strong>(grammarPath, callback)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Read a grammar asynchronously and add it to the registry.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>grammarPath</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> absolute file path to a grammar file.</span>
    </li>
    <li>
      <span class='type'>(Function)</span>
      <span class='name'>callback</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function'>Function</a> to call when loaded with <code>(error, grammar)</code> arguments.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='loadGrammarSync-instance'>
      Grammar ::<strong>loadGrammarSync</strong>(grammarPath)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Read a grammar synchronously and add it to this registry.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>grammarPath</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> absolute file path to a grammar file.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Grammar.html'>Grammar</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Grammar.html'>Grammar</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='readGrammar-instance'>
      ::<strong>readGrammar</strong>(grammarPath, callback)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Read a grammar asynchronously but don&#39;t add it to the registry.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>grammarPath</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> absolute file path to a grammar file.</span>
    </li>
    <li>
      <span class='type'>(Function)</span>
      <span class='name'>callback</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function'>Function</a> to call when loaded with <code>(error, grammar)</code> arguments.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='readGrammarSync-instance'>
      Grammar ::<strong>readGrammarSync</strong>(grammarPath)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Read a grammar synchronously but don&#39;t add it to the registry.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>grammarPath</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> absolute file path to a grammar file.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Grammar.html'>Grammar</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Grammar.html'>Grammar</a>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='removeGrammar-instance'>
      ::<strong>removeGrammar</strong>(grammar)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Remove a grammar from this registry.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(Grammar)</span>
      <span class='name'>grammar</span>
      &mdash;
      <span class='desc'>The <a href='Grammar.html'>Grammar</a> to remove.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='removeGrammarForScopeName-instance'>
      ::<strong>removeGrammarForScopeName</strong>(scopeName)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Remove the grammar with the given scope name.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>scopeName</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> such as <code>&quot;source.js&quot;</code>.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='selectGrammar-instance'>
      Grammar ::<strong>selectGrammar</strong>(filePath, fileContents)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Select a grammar for the given file path and file contents.</p><p>This picks the best match by checking the file path and contents against
each grammar.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>filePath</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> file path.</span>
    </li>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>fileContents</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> of text for the file path.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Grammar.html'>Grammar</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Grammar.html'>Grammar</a>, never null.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='setGrammarOverrideForPath-instance'>
      Grammar ::<strong>setGrammarOverrideForPath</strong>(filePath, scopeName)
      <a class='gh-link' href='https://github.com/atom/atom'>Source</a>
    </p>
    <div class='docstring'>
  <p>Set the grammar override for the given file path.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>filePath</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> file path.</span>
    </li>
    <li>
      <span class='type'>(String)</span>
      <span class='name'>scopeName</span>
      &mdash;
      <span class='desc'>A <a href='https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String'>String</a> such as <code>&quot;source.js&quot;</code>.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='Grammar.html'>Grammar</a></tt>)
      &mdash;
      <span class='desc'>Returns a <a href='Grammar.html'>Grammar</a> or undefined.</span>
    </li>
  </ul>
</div>
  </div>
</div>
    </div>
    <div id='footer'>
  Generated on
  Wed Mar 05 2014 08:55:13 GMT-0700 (MST)
  by
  <a href='https://github.com/gjtorikian/biscotto' title='TomDoc-CoffeeScript API documentation generator'>Biscotto</a>
  v2.1.1
  (Node.js v0.10.22).
  &#10034;
  Press Ctrl-h to see the keyboard shortcuts
</div>
  </body>
</html>